﻿<div id="libraryFileOrganizerPage" data-role="page" class="page type-interior pluginConfigurationPage withTabs" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Auto-Organize" data-controller="__plugin/AutoOrganizeTvJs">
    <div>
        <div class="content-primary">

            <form class="libraryFileOrganizerForm">

                <div>
                    <label class="checkboxContainer">
                        <input type="checkbox" is="emby-checkbox" id="chkEnableTvSorting" />
                        <span>Enable auto-organize for episodes</span>
                    </label>
                </div>
                <div class="inputContainer">
                    <div style="display:flex; align-items:center;">
                        <div style="flex-grow:1;">
                            <input is="emby-input" id="txtWatchFolder" type="text" label="Watch folder:" />
                            <div class="fieldDescription">This folder will be monitored for new episodes.</div>
                        </div>
                        <button type="button" is="paper-icon-button-light" id="btnSelectWatchFolder" title="Select directory" class="autoSize"><i class="material-icons search"></i></button>
                    </div>
                </div>
                <div class="inputContainer">
                    <input is="emby-input" id="txtMinFileSize" type="number" label="Min file size:" pattern="[0-9]*" min="0" required />
                    <div class="fieldDescription">Files smaller than this will be ignored.</div>
                </div>
                <div class="inputContainer">
                    <input is="emby-input" id="txtSeasonFolderPattern" type="text" label="Season folder pattern:" required />
                    <div class="fieldDescription seasonFolderFieldDescription"></div>
                </div>
                <div class="inputContainer">
                    <input is="emby-input" id="txtSeasonZeroName" type="text" label="Season zero folder name:" required />
                    <div class="fieldDescription"></div>
                </div>

                <div is="emby-collapse" title="Series directory pattern">
                    <div class="collapseContent">
                        <br />
                        <div class="inputContainer">
                            <input is="emby-input" id="txtSeriesPattern" type="text" label="Series pattern:" required />
                            <div class="fieldDescription seriesPatternDescription"></div>
                        </div>

                        <br />
                        <p>Supported Patterns</p>

                        <table id="series-table" class="ui-responsive">
                            <thead>
                                <tr>
                                    <th>Term</th>
                                    <th>Pattern</th>
                                    <th>Result</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>Series name</td>
                                    <td>%sn</td>
                                    <td>Series name</td>
                                </tr>
                                <tr>
                                    <td>Series name</td>
                                    <td>%s.n</td>
                                    <td>Series.name</td>
                                </tr>
                                <tr>
                                    <td>Series name</td>
                                    <td>%s_n</td>
                                    <td>Series_name</td>
                                </tr>
                                <tr>
                                    <td>Series year</td>
                                    <td>%sy</td>
                                    <td>2017</td>
                                </tr>
                                <tr>
                                    <td>Original Directory Path</td>
                                    <td>%fn</td>
                                    <td>Series name (2017)</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>

                <div is="emby-collapse" title="Episode file pattern">
                    <div class="collapseContent">
                        <br />
                        <div class="inputContainer">
                            <input is="emby-input" id="txtEpisodePattern" type="text" label="Episode pattern:" required />
                            <div class="fieldDescription episodePatternDescription"></div>
                        </div>
                        <div class="inputContainer">
                            <input is="emby-input" id="txtMultiEpisodePattern" type="text" label="Mutli-episode pattern:" required />
                            <div class="fieldDescription multiEpisodePatternDescription"></div>
                        </div>

                        <br />
                        <p>Supported Patterns</p>

                        <table id="episode-table" class="ui-responsive">
                            <thead>
                                <tr>
                                    <th>Term</th>
                                    <th>Pattern</th>
                                    <th>Result</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>Series name</td>
                                    <td>%sn</td>
                                    <td>Series name</td>
                                </tr>
                                <tr>
                                    <td>Series name</td>
                                    <td>%s.n</td>
                                    <td>Series.name</td>
                                </tr>
                                <tr>
                                    <td>Series name</td>
                                    <td>%s_n</td>
                                    <td>Series_name</td>
                                </tr>
                                <tr>
                                    <td>Season number</td>
                                    <td>%s</td>
                                    <td>1</td>
                                </tr>
                                <tr>
                                    <td>Season number</td>
                                    <td>%0s</td>
                                    <td>01</td>
                                </tr>
                                <tr>
                                    <td>Episode number</td>
                                    <td>%e</td>
                                    <td>4</td>
                                </tr>
                                <tr>
                                    <td>Episode number</td>
                                    <td>%0e</td>
                                    <td>04</td>
                                </tr>
                                <tr>
                                    <td>Ending episode number</td>
                                    <td>%ed</td>
                                    <td>5</td>
                                </tr>
                                <tr>
                                    <td>Ending episode number</td>
                                    <td>%0ed</td>
                                    <td>05</td>
                                </tr>
                                <tr>
                                    <td>Episode name</td>
                                    <td>%en</td>
                                    <td>Episode name</td>
                                </tr>
                                <tr>
                                    <td>Episode name</td>
                                    <td>%e.n</td>
                                    <td>Episode.name</td>
                                </tr>
                                <tr>
                                    <td>Episode name</td>
                                    <td>%e_n</td>
                                    <td>Episode_name</td>
                                </tr>
                                <tr>
                                    <td>File extension</td>
                                    <td>%ext</td>
                                    <td>mkv</td>
                                </tr>
                                <tr>
                                    <td>Original File Name</td>
                                    <td>%fn</td>
                                    <td>filename</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>

                <br /><br />
                <div class="selectContainer">
                    <select is="emby-select" id="copyOrMoveFile" label="Transfer method:">
                        <option value="true">Copy</option>
                        <option value="false">Move</option>
                    </select>
                    <div class="fieldDescription editorfieldDescription">Copy or move files from the watch folder</div>
                </div>
                <div>
                    <label class="checkboxContainer">
                        <input type="checkbox" is="emby-checkbox" id="chkOverwriteExistingEpisodes" />
                        <span>Overwrite existing episodes</span>
                    </label>
                </div>
                <div class="inputContainer">
                    <input is="emby-input" id="txtDeleteLeftOverFiles" type="text" label="Delete left over files" />
                    <div class="fieldDescription">Provide a list of file extensions to delete, separated by semicolons (;)</div>
                </div>
                <div class="checkboxContainer checkboxContainer-withDescription">
                    <label>
                        <input type="checkbox" is="emby-checkbox" id="chkDeleteEmptyFolders" />
                        <span>Delete empty folders</span>
                    </label>
                    <div class="fieldDescription checkboxFieldDescription">Empty folders will be deleted</div>
                </div>
                <div class="checkboxContainer checkboxContainer-withDescription">
                    <label>
                        <input type="checkbox" is="emby-checkbox" id="chkExtendedClean" />
                        <span>Extended Clean</span>
                    </label>
                    <div class="fieldDescription checkboxFieldDescription">Extended clean of left over files and empty folders</div>
                </div>
                <div class="checkboxContainer checkboxContainer-withDescription">
                    <label>
                        <input type="checkbox" is="emby-checkbox" id="chkQueueLibScan" />
                        <span>Queue library scan on completion</span>
                    </label>
                    <div class="fieldDescription checkboxFieldDescription">Queue a library scan on completion, if setted in movies and TV Shows, the library scan will be triggered once</div>
                </div>
                <div class="checkboxContainer checkboxContainer-withDescription">
                    <label>
                        <input type="checkbox" is="emby-checkbox" id="chkEnableSeriesAutoDetect" />
                        <span>Enable auto-detect for Series</span>
                    </label>
                    <div class="fieldDescription checkboxFieldDescription">Warning Beta feature, Use with caution, this may cause significantly longer scans and false identification</div>
                </div>
                <div class="fldSelectSeriesFolder hide selectContainer">
                    <select id="selectSeriesFolder" is="emby-select" label="Default Series library:"></select>
                </div>
                <div>
                    <button is="emby-button" type="submit" class="raised button-submit block"><span>Save</span></button>
                </div>
            </form>

        </div>
    </div>
</div>
